package com.ciwong.epaper.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ciwong.epaper.R;



/**
 * Created by keepon on 2018/9/3.
 */
public class WordPlanNumberView extends RelativeLayout {
	private  boolean mBottomTextShow;
	private String mBottomText,mTopText;
	private TextView mTvTop,mTvBottom,mTvMiddle;

	public WordPlanNumberView(Context context) {
		this(context,null);
	}

	public WordPlanNumberView(Context context, AttributeSet attrs) {
		this(context, attrs,0);
	}

	public WordPlanNumberView(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);

		TypedArray mTypedArray = context.obtainStyledAttributes(attrs,
				R.styleable.WordPlanNumberView);
		mBottomText = mTypedArray.getString(R.styleable.WordPlanNumberView_right_bottom_text);
		mBottomTextShow = mTypedArray.getBoolean(R.styleable.WordPlanNumberView_right_bottom_text_show,true);
		mTopText = mTypedArray.getString(R.styleable.WordPlanNumberView_top_text);
		init();

	}

	private void init() {
		View.inflate(getContext(), R.layout.layout_word_plan_number,this);
		mTvTop=findViewById(R.id.tv_top);
		mTvBottom=findViewById(R.id.tv_bottom);
		mTvMiddle=findViewById(R.id.tv_middle);

		mTvBottom.setText(mBottomText);
		mTvTop.setText(mTopText);
		if(!mBottomTextShow){
			mTvBottom.setVisibility(GONE);
		}
	}
	public  void setCount(int count){
		mTvMiddle.setText(count+"");
	}

}
